<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
namespace Api\Api;
/**
 * Description of Base
 *
 * @author Administrator
 */
class Base {
    const SKU_ERROR=100;
    const STOCK_NOT_ENOUGH=250;
    const UPDATE_FAIL=310;
    const UPDATE_SUCC=311;
    const ADD_FAIL=300;
    const ADD_SUCC=301;
    const ORDER_ID_ERROR=401;
    const USER_ID_ERROR=411;
    
    protected  $_error = '';
    protected  $_code = 0;
    
    function __construct() {
        
    }
    function getError() {
        return $this->_error;
    }
    function getCode() {
        return $this->_code;
    }
    function setError($code,$error){
        $this->_code=$code;
        $this->_error=$error;
    }
    
    function get_channel_code($site_id){
        $codes=D("customer")->where(array("id"=>$site_id))->cache(2000)->find();
        return $codes['code']?$codes['code']:'';
    }
    
}
